import type { Metadata } from 'next'; import Link from 'next/link'; import { ScopeHeader } from '@/components/detail/ScopeHeader'; import { ScopePressureChart } from '@/components/detail/ScopeCharts'; import { TargetsTable } from '@/components/detail/Tables'; import { IncidentsSection } from '@/components/incidents/IncidentsSection'; import { ProbeTargetMatrix } from '@/components/service/ProbeTargetMatrix'; import { VendorIndicator } from '@/components/service/VendorIndicator'; import { Section, Stat } from '@/components/ui/primitives'; import { apiGet, apiTry } from '@/lib/api'; import { fmt, fmtInt, fmtMs, fmtPct } from '@/lib/format'; import { Time } from '@/lib/time'; import type { ServiceDetail } from '@/lib/types'; export const dynamic = 'force-dynamic'; type Params = Promise<{ slug: string }>; export async function generateMetadata({ params }: { params: Params }): Promise { const { slug } = await params; const s = await apiTry(`/api/v1/service/${encodeURIComponent(slug)}`); if (!s) return { title: 'Service' }; return { title: `${s.name} — observed pressure ${fmt(s.pressure)}, availability ${fmtPct(s.observed.availability_24h, 2)}`, description: s.discrepancy ?? `Independent observation of ${s.name} from our probe network versus the vendor status page.`, alternates: { canonical: `/service/${s.slug}` } }; } export default async function ServicePage({ params }: { params: Params }) { const { slug } = await params; const s = await apiGet(`/api/v1/service/${encodeURIComponent(slug)}`); const ttfbShift = s.observed.ttfb_ms_median_1h - s.observed.ttfb_ms_baseline; return (
{fmtInt(s.targets.length)} endpoints measured from every probe · observed availability 24 h {fmtPct(s.observed.availability_24h, 2)}} pressure={s.pressure} level={s.level} /> {s.discrepancy && (

Discrepancy

{s.discrepancy}

)}
{fmtPct(s.observed.availability_1h, 2)}} /> 5 ? 'var(--p-elevated)' : undefined }}>{fmtInt(s.observed.failures_1h)}} /> = 0 ? '+' : ''}${fmt(ttfbShift, 0)} ms`} /> {fmt(s.pressure)}} />
{s.vendor_status ? (
checked

{s.vendor_status.incidents ? `${s.vendor_status.incidents} incident${s.vendor_status.incidents > 1 ? 's' : ''} declared` : 'No incident declared'} · source{' '} {s.vendor_status.url ? ( {s.vendor_status.source} ) : ( s.vendor_status.source )}

{s.vendor_status.titles?.length ? (
    {s.vendor_status.titles.map((t, i) => (
  • {t}
  • ))}
) : null}
) : (

No status-page connector for this provider — only our independent observation is shown.

)}
observed from our probes}> {s.affected_regions.length ? (
    {s.affected_regions.map((r) => (
  • {r.name} {r.observation}
  • ))}
) : (

No region shows an anomaly toward this service right now.

)}
cell = robust z of TTFB vs baseline · red = failing}>
); }